﻿using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Controls;
using System.Windows.Shapes;
using KBS8.Shared;

namespace KBS8.Presentation.MapView.DrawHandler
{
    public class WaterDrawHandler : DrawHandler
    {
        public WaterDrawHandler()
        {
            this.Pen = new Pen(new SolidColorBrush(MapStyle.Water), 1);
        }

        /// <summary>
        /// Handles map data or passes it on to another DrawHandler
        /// </summary>
        /// <param name="data">The map data to handle</param>
        /// <param name="dc">The DrawingContext to draw on</param>
        public override void Handle(MapTile data, ref DrawingContext dc)
        {
            Rect rect = new Rect(data.rec.Height * 0.08, data.rec.Width * 0.08, data.rec.Height * 0.92, data.rec.Width * 0.92);
            dc.DrawRectangle(new SolidColorBrush(MapStyle.Water), (Pen)null, rect);

            if (Successor != null)
                Successor.Handle(data, ref dc);
        }
    }
}
